package com.naiterui.ehp.bs.patient.controller.inner;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.patient.exception.ExceptionCodes;
import com.naiterui.ehp.bs.patient.service.IParametersService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <pre>
 *  参数配置
 * </pre>
 *
 * @author 王泽浩
 * @date 2018/6/4 下午2:32
 * @since 1.0.0
 */
@Api(tags = {SwaggerTag.PATIENT + SwaggerTag.INNER_API + SwaggerTag.OTHER})
@Controller
@RequestMapping("ap/inner/parameters")
public class ApInnerParametersController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ApInnerParametersController.class);

    @Autowired
    private IParametersService parametersService;

    /**
     * 刷新业务配置
     *
     * @return
     *
     * @throws BusinessException
     */
    @RequestMapping("/refreshParams")
    public ResponseVO<Void> refreshParams() throws BusinessException {
        LOGGER.info("参数配置缓存刷新成功!");
        this.parametersService.refreshParameters();
        return PublicService.returnResponseVO(ExceptionCodes.SUCCESS);
    }
}
